﻿using System.Collections.Generic;
using DeepEarth.Core.Data;
using System.Linq;
using System;
using DeepEarth.Map.Core.Clustering;
namespace DeepEarth.Map.Core.Filters
{
    public static class Verify
    {
        public static void Check(List<ClusterViewModel> viewModels)
        {
            Dictionary<ClusterViewModel, ClusterViewModel> allExistingFlat = new Dictionary<ClusterViewModel, ClusterViewModel>();

            foreach (var cvm in viewModels)
            {
                allExistingFlat.Add(cvm, cvm);

                foreach (var child in cvm.GetClusteredItems())
                {
                    System.Diagnostics.Debug.Assert(child != cvm);
                    System.Diagnostics.Debug.Assert(!child.IsCluster);
                    allExistingFlat.Add(child, child);
                }
            }

        }

        public static int Count(List<ClusterViewModel> viewModels)
        {
            Dictionary<ClusterViewModel, ClusterViewModel> allExistingFlat = new Dictionary<ClusterViewModel, ClusterViewModel>();

            int counter = 0;

            foreach (var vm in viewModels)
            {
                counter += vm.GetClusterSize();
            }

            return counter;

        }
    }
}
